<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
  	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<title>${SYSTEM_NAME}</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/layui/css/layui.css?v=${FILE_VERSION}" media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiadmin/style/admin.css?v=${FILE_VERSION}" media="all">
</head>
<body>
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-body" style="padding: 15px;">
		<form class="layui-form" method="post" id="basicform" >
			<input id="id" name="id" value="${wxUserinfo.id }" type="hidden">

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">微信编号
				</label>
				<div class="layui-input-block">
					<input name="openId" placeholder="请输入微信编号"
						   class="layui-input" value="${wxUserinfo.openId }"
						   maxlength="64"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">手机号
				</label>
				<div class="layui-input-block">
					<input name="phone" placeholder="请输入手机号"
						   class="layui-input" value="${wxUserinfo.phone }"
						   maxlength="18"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">登录密码
				</label>
				<div class="layui-input-block">
					<input name="cipher" placeholder="请输入登录密码"
						   class="layui-input" value="${wxUserinfo.cipher }"
						   maxlength="64"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">是否禁用</label>
				</label>
				<div class="layui-input-inline">
					<select   name="disable">
						<c:forEach items="${DISABLE_MAP}" var="t">
							<option value="${t.key }" <c:if test="${t.key eq wxUserinfo.disable}">selected="selected"</c:if>>${t.value }</option>
						</c:forEach>
					</select>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">身份证号
				</label>
				<div class="layui-input-block">
					<input name="idCard" placeholder="请输入身份证号"
						   class="layui-input" value="${wxUserinfo.idCard }"
						   maxlength="18"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">微信昵称
				</label>
				<div class="layui-input-block">
					<input name="nickName" placeholder="请输入微信昵称"
						   class="layui-input" value="${wxUserinfo.nickName }"
						   maxlength="64"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">微信头像
				</label>
				<div class="layui-input-block">
					<input name="avatarUrl" placeholder="请输入微信头像"
						   class="layui-input" value="${wxUserinfo.avatarUrl }"
						   maxlength="512"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">性别</label>
				</label>
				<div class="layui-input-inline">
					<select   name="gender">
						<c:forEach items="${SEX_MAP}" var="t">
							<option value="${t.key }" <c:if test="${t.key eq wxUserinfo.gender}">selected="selected"</c:if>>${t.value }</option>
						</c:forEach>
					</select>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">省
				</label>
				<div class="layui-input-block">
					<input name="province" placeholder="请输入省"
						   class="layui-input" value="${wxUserinfo.province }"
						   maxlength="6"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">市
				</label>
				<div class="layui-input-block">
					<input name="city" placeholder="请输入市"
						   class="layui-input" value="${wxUserinfo.city }"
						   maxlength="6"
							/>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">县
				</label>
				<div class="layui-input-block">
					<input name="country" placeholder="请输入县"
						   class="layui-input" value="${wxUserinfo.country }"
						   maxlength="6"
							/>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					<button type="button" class="layui-btn layui-btn-danger" onclick="closed()">关闭</button>
				</div>
			</div>
		</form>
	</div>
	</div>
</div>
	<script src="${pageContext.request.contextPath}/static/js/common-2.0.0.js?v=${FILE_VERSION}"></script>
	<script src="${pageContext.request.contextPath}/static/layuiadmin/layui/layui.js?v=${FILE_VERSION}"></script>
	<script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js?v=${FILE_VERSION}"></script>
	<script>
		layui.use(['form', 'layer', 'laydate'], function() {
			var form = layui.form;

			form.on('submit(sub)', function(data){

				$ajax({
					url: "/wx/user/add/save",
					data :  data.field,
			        succCallback: function (json) {
						if(json.code == 0){
			        		parent.reload();
		            		parent.layer.closeAll();
		            		parent.layer.msg(json.msg);
			        	}
			        }
				});
				return false;
			});

		});

		function closed(){
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}

	</script>
</body>
</html>